package com.tf.xx.controller;

import com.tf.xx.R;
import com.tf.xx.entity.EduCourse;
import com.tf.xx.entity.EduTeacher;
import com.tf.xx.service.EduCourseService;
import com.tf.xx.service.EduTeacherService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Tag(name = "indexFront", description = "前台首页管理")
@RestController
@RequestMapping("/eduservice/indexFront")
public class IndexFrontController {
    @Autowired
    private EduCourseService eduCourseService;
    @Autowired
    private EduTeacherService eduTeacherService;
    //查询前8条热门课程，查询前四个热门老师


    @GetMapping("/index")
    public R index() {
        List<EduCourse> courseList = eduCourseService.selectHotCourse();
        List<EduTeacher> teacherList = eduTeacherService.selectHotTeacher();

        return R.ok().data("courseList", courseList).data("teacherList", teacherList);


    }
}
